package com.timu.bean;

import java.io.Serializable;
import java.util.Map;

/**
 * @描述:
 * @Author: zhangh
 * @Time: 2020/12/30 18:00
 **/
public class ServiceResult<T> implements Serializable {
    private int errno;
    private String msg;
    private Result data;
    private static final int SUUCESS=0;



    public int getErrno() {
        return errno;
    }

    public ServiceResult(int errno){
        this.errno=errno;
    }

    public ServiceResult(T data){
        this.errno=SUUCESS;
        this.data=new Result<T>(data);
    }

    public ServiceResult(int errno, String msg, Result data) {
        this.errno = errno;
        this.msg = msg;
        this.data = data;
    }

    @Override
    public String toString() {
        return "ServiceResult{" +
                "errno=" + errno +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public void setErrno(int errno) {
        this.errno = errno;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Result getData() {
        return data;
    }

    public void setData(Result data) {
        this.data = data;
    }

    public static class Result<T>{
        private T context;
        private String value;

        Result(T context){
            this.context=context;
        }


        public T getContext() {
            return context;
        }

        public void setContext(T context) {
            this.context = context;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return "Result{" +
                    "context=" + context +
                    ", value='" + value + '\'' +
                    '}';
        }
    }
}
